package com.example.springboottestgit.service.instruction.stage1;

import com.example.springboottestgit.bean.InstructData;
import com.example.springboottestgit.common.RunNum;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * @description:招标公告期限
 * @author: ZZZ
 */
@Service
public class TbNoticeTerm {

    public List<InstructData> getInstructData() {
        Random random = new Random();
        List<InstructData> list = new ArrayList<>();
        for (int i = 1; i <= RunNum.a; i++) {
            list.add(mul(i % 2 == 0));
        }
        return list;
    }

    //招标文件的质疑时效期
    public InstructData mul(Boolean b) {
        Random random = new Random();
        //int x = random.nextInt(100);
        //Boolean b = random.nextBoolean();
        int x = random.nextInt(6) + 1;
        if (b == true) {
            x = random.nextInt(30) + 5;

        }

        String sign = x >= 5 ? "符合" : "不符合";
        String c = x >= 5 ? "大于等于" : "小于";


        String instruction = "招标公告的公告期限设定为发布公告之日起x个工作日是否符合法律法规";
        String input = "";
        String output = "#。根据《中华人民共和国政府采购法实施条例》第三十一条规定，招标文件的提供期限自招标文件开始发出之日起不得少于5个工作日。招标公告作为招标文件的一部分，其公告期限也应满足这一要求。因为案例中招标公告的公告期x个工作日c5个工作日，所以将招标公告的公告期限设定为x个工作日#法律法规。";

        instruction = instruction.replace("x", x + "");
        output = output.replace("x", x + "").replace("#", sign + "").replace("c", c + "");

        InstructData instructData = new InstructData();
        instructData.setInstruction(instruction);
        instructData.setInput("");
        instructData.setOutput(output);
        return instructData;
    }
}
